<template>
	<view>
		<view style="font-weight:bold;margin-left: 25rpx;">查询条件</view>
		<u-divider :use-slot="false" half-width="370"></u-divider>
		<!-- 注意，如果需要兼容微信小程序，最好通过setRules方法设置rules规则 -->
		<u-form labelPosition="left" :model="form" ref="uForm" label-width="200rpx">
			<u-form-item label="产品物料编码:" prop="itemCode" borderBottom><u-input v-model="form.itemCode" placeholder="请输入物料编码" :border="border"></u-input></u-form-item>
			<u-form-item label="产品物料名称:" prop="itemName" borderBottom><u-input v-model="form.itemName" placeholder="请输入物料名称" :border="border"></u-input></u-form-item>
			<u-form-item label="仓库名称:" prop="warehouseName" borderBottom>
				<u-input v-model="form.warehouseName" placeholder="请输入仓库名称" :border="border"></u-input>
			</u-form-item>
			<u-form-item label="供应商编码:" prop="vendorCode" borderBottom>
				<u-input v-model="form.vendorCode" placeholder="请输入供应商编码" :border="border"></u-input>
			</u-form-item>
			<u-form-item label="供应商名称:" prop="vendorName" borderBottom>
				<u-input v-model="form.vendorName" placeholder="请输入供应商名称" :border="border"></u-input>
			</u-form-item>
			<u-form-item label="入库批次号:" prop="batchCode" borderBottom><u-input v-model="form.batchCode" placeholder="请输入批次号" :border="border"></u-input></u-form-item>
		</u-form>
		<view class="buttons">
			<u-button type="primary" size="medium" shape="circle" @click="handleSearch()">查询</u-button>
			<u-button type="default" size="medium" shape="circle" @click="resetForm('uForm')">清空</u-button>
		</view>
	</view>
</template>
<script>
export default {
	data() {
		return {
			form: {
				pageNum: 1,
				pageSize: 10,
				itemCode: '',
				itemName: '',
				warehouseName: '',
				vendorCode: '',
				vendorName: '',
				batchCode: ''
			},
			border: false
		};
	},
	methods: {
		handleSearch() {
			uni.navigateTo({
				url: '/pages/sys/home/components/work_bench/inventory-inquiry/inventory_inquiry?params=' + JSON.stringify(this.form)
			});
		},
		//重置
		resetForm(formName) {
			this.$refs[formName].resetFields();
		}
	},
	onReady() {
		//如果需要兼容微信小程序，并且校验规则中含有方法等，只能通过setRules方法设置规则。
		this.$refs.uForm.setRules(this.rules);
	}
};
</script>

<style lang="scss" scoped>
.u-form {
	padding: 0 40rpx;
}
.buttons {
	margin-top: 50rpx;
	display: flex;
	justify-content: space-between;
}
</style>
